home *** CD-ROM | disk | FTP | other *** search
- unit CallerU;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- published
- procedure MyRoutine(const Msg: string);
- end;
-
- TCustomProc = procedure (const Msg: string) of object;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.MyRoutine(const Msg: string);
- begin
- MessageDlg(Msg, mtInformation, [mbOk], 0)
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- ShowMessage('A button was pushed... or was it?')
- end;
-
- procedure TForm1.Button2Click(Sender: TObject);
- var
- Proc: TNotifyEvent;
- begin
- @Proc := MethodAddress('Button1Click');
- if Assigned(Proc) then
- Proc(nil);
- end;
-
- procedure TForm1.Button3Click(Sender: TObject);
- var
- Proc: TCustomProc;
- begin
- @Proc := Self.MethodAddress('MyRoutine');
- if Assigned(Proc) then
- Proc('Hello world');
- end;
-
- end.
-